<?php
defined('BASEPATH') OR exit('No direct script access allowed');
	class test_product_model extends CI_Model{
        public $table_name='product';
    	public function get_all(){
            $query=$this->db->order_by('id','desc')->limit(20)->get($this->table_name);
            return $query->result();
        }
        public function add($data){
            $this->db->insert($this->table_name,$data);
        }
        public function get_one($id){
           $query= $this->db->where('id',$id)->get($this->table_name);
           return $query->row();
        }
        public function edit($data,$id){
            $this->db->update($this->table_name, $data, "id = $id");
        }
        public function del($id){
            $this->db->where('id',$id)->delete($this->table_name);
        }
        public function reasch($content){
            $query=$this->db->like('content',$content)->get($this->table_name);
            return $query->result();
        }

	}